package com.tanhua.dubbo.api.impl.mongo;

import com.tanhua.domain.mongo.SoulResult;
import com.tanhua.dubbo.api.mongo.SoulResultApi;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

@Service
public class SoulResultApiImpl implements SoulResultApi {


    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public SoulResult findConclusion(Integer resultId) {
        Query query = Query.query(Criteria.where("resultId").is(resultId.toString()));
        SoulResult result = mongoTemplate.findOne(query, SoulResult.class);
        return result;
    }
}
